function DateUtil(date){
    if(date instanceof  Date) {
        this._date = date;
    }else {
        this._date = new Date();
    }
}
DateUtil.prototype.format = function(){
    var year = this._date.getFullYear();
    var month = this._date.getMonth()+1;
    var day = this._date.getDate();
    var hours = this._date.getHours();
    var minutes = this._date.getMinutes();
    var seconds = this._date.getSeconds();
    return ""+this.createDoubleDigit(year)+"-"+this.createDoubleDigit(month)+"-"+this.createDoubleDigit(day)+" "
            +this.createDoubleDigit(hours)+":"+this.createDoubleDigit(minutes)+":"+this.createDoubleDigit(seconds);
}
DateUtil.prototype.createDoubleDigit = function(num){
    if(num <= 9) {
        return "0"+num;
    }else{
        return num;
    }

}
export default DateUtil;